﻿using Hetang.Areas.User.Models.Classes.Config;
using Hetang.Models.DataContext;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Hetang.Models.Interface
{
    public interface IDatabaseRepository
    {
        /// <summary>
        /// 通过用户名获取账户
        /// </summary>
        /// <returns></returns>
        tbl_Account GetAccountByUserName();

        /// <summary>
        /// 通过邮箱获取账户
        /// </summary>
        /// <returns></returns>
        tbl_Account GetAccountByEmail(string email);

        /// <summary>
        /// 通过用户ID获取公司
        /// </summary>
        /// <returns></returns>
        tbl_Company GetCompanyByAccountId();

        /// <summary>
        /// 通过用户ID获取公司部门
        /// </summary>
        /// <returns></returns>
        string GetCompanyDepartment();

        /// <summary>
        /// 通过ID获取公司
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        tbl_Company GetCompanyById();

        /// <summary>
        /// 获取公司ID
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        int GetCompanyId();

        /// <summary>
        /// 获取公司所发布的工作的数量
        /// </summary>
        /// <returns></returns>
        int GetNumsOfJob();

        tbl_Job GetJobByJobId(int? id);

        /// <summary>
        /// 检查是否有重复的工作数据
        /// </summary>
        /// <returns></returns>
        bool CheckRepeatOfJob(string jobName);

        /// <summary>
        /// 通过账户ID获取简历
        /// </summary>
        /// <returns></returns>
        tbl_Resume GetResume();

        /// <summary>
        /// 通过ID获取简历
        /// </summary>
        /// <param name="id">简历ID</param>
        /// <returns></returns>
        tbl_Resume GetResumeById(int id);

        /// <summary>
        /// 获取简历ID
        /// </summary>
        /// <returns></returns>
        int GetResumeId();

        /// <summary>
        /// 通过公司ID添加招聘信息
        /// </summary>
        /// <param name="id"></param>
        void InsertJob(tbl_Job job);

        /// <summary>
        /// 添加账户
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        void CreateAccount(tbl_Account account);

        /// <summary>
        /// 添加公司
        /// </summary>
        /// <param name="company"></param>
        /// <returns></returns>
        void AddCompany(tbl_Company company);

        /// <summary>
        /// 添加简历
        /// </summary>
        /// <param name="resume"></param>
        /// <returns></returns>
        void AddResume(tbl_Resume resume);

        /// <summary>
        /// 添加工作
        /// </summary>
        /// <param name="job"></param>
        /// <returns></returns>
        void AddJob(tbl_Job job);

        /// <summary>
        /// 删除招聘信息
        /// </summary>
        /// <param name="id">招聘信息ID</param>
        /// <returns></returns>
        bool DeleteJobByJobId(int id);

        /// <summary>
        /// 更新简介
        /// </summary>
        /// <param name="resume"></param>
        void UpdateResume(tbl_Resume resume);

        /// <summary>
        /// 更新公司基本信息
        /// </summary>
        /// <param name="resume"></param>
        void UpdateCompany(tbl_Company company);

        /// <summary>
        /// 获取电子邮件地址
        /// </summary>
        /// <returns></returns>
        string GetEmail();

        /// <summary>
        /// 获取工作列表
        /// </summary>
        /// <returns></returns>
        List<tbl_Job> GetJobList();

        /// <summary>
        /// 获取当前用户最后操作的EmailCode
        /// </summary>
        /// <param name="emailType">操作类型</param>
        /// <returns></returns>
        tbl_EmailCode GetLastHandleEmailCode(EmailType emailType);

        /// <summary>
        /// 插入EmailCode
        /// </summary>
        /// <param name="emailCode"></param>
        void InsertEmailCode(tbl_EmailCode emailCode);

        /// <summary>
        /// 保存对数据库的操作
        /// </summary>
        void Save();
    }
}